package com.baidu.cmsService.dao;

import com.baidu.cmsCommes.pojo.UserGroup;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author: BSS
 * @create: 2020/6/18/16:49
 */
@Mapper
public interface UserGroupDao {
    @Insert("insert into t_user_group(id,g_id,u_id)value(#{id},#{gId},#{uid})")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    Integer save(@Param("id") Integer id, @Param("gId") Integer rId, @Param("uid") Integer uid);

    @Select("select * from t_user_group where u_id=#{id}")
    @ResultType(UserGroup.class)
    List<UserGroup> selectByUid(@Param("id") Integer id);

    @Delete("delete from t_user_group where u_id=#{uid}")
    Integer deleteGroupByUid(@Param("uid") Integer uid);

    @Delete("delete from t_user_group where g_id=#{gid}")
    Integer deleteByGid(@Param("gid")Integer gid);
}
